/*! \file Factory.cpp
 *	\brief 
 *
 *	created:	2010/03/11
 *	created:	11:3:2010   2:08
 *	filename: 	c:\src\tactics-engine\libs\gd_win\Factory.cpp
 *	file path:	c:\src\tactics-engine\libs\gd_win
 *	file base:	Factory
 *	file ext:	cpp
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */

#include "gd_win/stdafx.h"
#include "gd_win/Factory.h"

#include "gd/gd.h"
#include "utils/Library.h"

#define GD_DRIVER_NAME(name) TEXT(name) TEXT(".dll")

namespace tt{
namespace gd_win{

Factory::Factory()
{
}

Factory::~Factory()
{

}

SharedPtr<gd::Driver> Factory::createDriver()
{
	m_gd_library.reset( new utils::Library(GD_DRIVER_NAME("gd_dx11")) );
	SharedPtr<gd::Driver> driver = gd::createDriver(m_gd_library);

	if(!driver)
	{
		m_gd_library.reset( new utils::Library(GD_DRIVER_NAME("gd_dx9")) );
		driver = gd::createDriver(m_gd_library);
	}

	return driver;
}

} //namespace gd_win
} //namespace tt